function P = fsb_get_files_sandbox(prefix,format)

% FSB : get files in cell format
%
% EXAMPLE:
% P = fsb_get_files_sandbox('r')
%
% INPUT:
% prefix:   Prefix to the file names you need
% format:   enter any value here to append a 1 to the file list for
%           compatibility with SPM
%
% OUTPUT:
% P:        Cell array of image file names
%
% CALLED BY:
% fsb_prepare_SPM.m
% fsb_realign_SPM.m
%
% Copyright 2010 MPI for Biological Cybernetics
% Author: Steffen Stoewer
% License: GNU GPL, no express or implied warranties
% 
%$ Revision 1.0
%
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% Check for prefix
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if ~exist('prefix','var');
    prefix = '';
end

%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
% Go over files
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thedir = cd;
all_files = dir([thedir  '\' prefix '*.img']);

for x = 1:size(all_files);
    if nargin==1
        P{x} = (all_files(x).name);
    else
        P{x} = [(all_files(x).name) ',1'];
    end
end

end
